<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>带一个参数的函数</title>
</head>

<body>
    <p>单击“试一试”以使用参数来调用函数</p>
    <button onclick="myFunction('Harry Potter','Wizard')">试一试</button>
    <p id="demo"></p>
    <script>
        function myFunction(name,job){
            document.getElementById("demo").innerHTML ="welcome" + name + " , the "+ job + ". ";
        }
    </script>
</body>

</html>